﻿<Window x:Class="WMSSoft.WinKStart.Settings_NewEditContextMenuTarget"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Name="SettingsNewEditContextMenuTarget"
        Title="{Binding ViewName}" Height="330" Width="455" ResizeMode="NoResize" ShowInTaskbar="True" WindowStartupLocation="CenterOwner" Icon="/WinKStart;component/grfx/preferences-other.png" WindowStyle="ToolWindow">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="19*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="1" Orientation="Horizontal" FlowDirection="RightToLeft" Margin="0,0,10,0" >
            <Button Content="{Binding Cmd_ApplyClick.ViewName}" Grid.Column="2" Height="23" HorizontalAlignment="Left" Margin="0,10,20,5" Width="100" IsCancel="True" Command="{Binding Cmd_ApplyClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditContextMenuTarget}" />
            <Button Content="{Binding Cmd_CloseClick.ViewName}" Grid.Column="0" Height="23" HorizontalAlignment="Right" Margin="0,10,5,5" Width="100" IsDefault="True" Command="{Binding Cmd_CloseClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditContextMenuTarget}"/>
            <Button Content="{Binding Cmd_OkClick.ViewName}" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="5,10,0,5" Width="100" IsCancel="True" Command="{Binding Cmd_OkClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditContextMenuTarget}" />
        </StackPanel>
        <Grid Margin="10,10,10,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="25"/>
                <RowDefinition Height="Auto" />
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Label Content="Name:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,10,5" VerticalAlignment="Top"/>
            <TextBox Grid.Column="1" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding Name}" VerticalContentAlignment="Center"/>
            <Label Content="Type:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,10,5" VerticalAlignment="Top" Grid.Row="1"/>
            <ComboBox SelectedValue="{Binding Type}" SelectedValuePath="Key" DisplayMemberPath="Value"  ItemsSource="{Binding TargetTypes}" Grid.Column="1" Grid.Row="1" Margin="0,0,0,5"/>
            <Label Content="Used in:" HorizontalAlignment="Left" Margin="0,0,0,0" Padding="0,2,0,0" VerticalAlignment="Top" Grid.Row="2"/>
            <Grid Grid.Column="1" Grid.Row="2" Margin="0,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <ImageBrush x:Key="AddButtonImageBrush" ImageSource="/WinKStart;component/images/list-add.png" Stretch="Fill"/>
                    <ImageBrush x:Key="DeleteButtonImageBrush" ImageSource="/WinKStart;component/images/list-remove.png" Stretch="Fill"/>
                </Grid.Resources>
                <ListBox x:Name="lst_ContextMenuItemRegions" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding UsedIn, Mode=TwoWay}" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedItem="{Binding SelectedUsedIn}" Margin="0"/>
                <StackPanel Grid.Column="1">
                    <Button Content="" Margin="5,0,0,10" Height="20" Background="{StaticResource AddButtonImageBrush}" Command="{Binding Cmd_AddUsedInClick.Command}" CommandParameter="{Binding ElementName=lst_ContextMenuItemRegions}" RenderTransformOrigin="2,0"/>
                    <Button Content="" Margin="5,0,0,10" Width="20"  Background="{StaticResource DeleteButtonImageBrush}" Command="{Binding Cmd_DeleteUsedInClick.Command}" CommandParameter="{Binding ElementName=lst_ContextMenuItemRegions}" IsEnabled="{Binding CanEditDeleteUsedIn}"/>
                </StackPanel>
            </Grid>
            <Label Content="Custom-Items:" HorizontalAlignment="Left" Margin="0,5,5,0" Padding="0,2,0,0" VerticalAlignment="Top" Grid.Row="3"/>
            <Grid Grid.Column="1" Grid.Row="3" Margin="0,5,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="322"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <ImageBrush x:Key="AddButtonImageBrush" ImageSource="/WinKStart;component/images/list-add.png" Stretch="Fill"/>
                    <ImageBrush x:Key="EditButtonImageBrush" ImageSource="/WinKStart;component/images/list-edit.png" Stretch="Fill"/>
                    <ImageBrush x:Key="DeleteButtonImageBrush" ImageSource="/WinKStart;component/images/list-remove.png" Stretch="Fill"/>
                </Grid.Resources>
                <ListView Name="lsv_ContextMenuItems" Width="322" ItemsSource="{Binding CustomMenuItems}" SelectedItem="{Binding SelectedMenuItem}" MaxWidth="322">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Name  " DisplayMemberBinding="{Binding Name}" Width="150" />
                            <GridViewColumn Header="Caption" DisplayMemberBinding="{Binding Caption}" Width="150" />
                            <GridViewColumn Header="Menu ID" DisplayMemberBinding="{Binding MenuID}" Width="80" />
                        </GridView>
                    </ListView.View>
                </ListView>
                <StackPanel Grid.Column="1">
                    <Button Content="" Margin="5,0,0,10" Height="20" Width="20" Background="{StaticResource AddButtonImageBrush}" Command="{Binding Cmd_AddClick.Command}" CommandParameter="{Binding ElementName=lsv_ContextMenuItems}" RenderTransformOrigin="2,0"/>
                    <Button Content="" Margin="5,0,0,10" Height="20" Width="20" Background="{StaticResource EditButtonImageBrush}" Command="{Binding Cmd_EditClick.Command}" CommandParameter="{Binding ElementName=lsv_ContextMenuItems}" IsEnabled="{Binding CanDeleteItem}" TabIndex="18" />
                    <Button Content="" Margin="5,0,0,10" Height="20" Width="20" Background="{StaticResource DeleteButtonImageBrush}" Command="{Binding Cmd_DeleteClick.Command}" CommandParameter="{Binding ElementName=lsv_ContextMenuItems}" IsEnabled="{Binding CanDeleteItem}"/>
                </StackPanel>
            </Grid>            
        </Grid>


    </Grid>
</Window>
